/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package VideoClient;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;


/**
 *
 * @author Travis Shuff
 * @since 10/4/11
 * 
 */
public class Video_Client implements Runnable {

    private Socket socket;
    private DataOutputStream toServer;
    private DataInputStream fromServer;
    private String hostAdress;
    
    public Video_Client() {

        
        //get host address from database
        
        
        try {
            // Create a socket to connect to the server
            socket = new Socket(hostAdress, 9999);

            // input stream to receive data
            fromServer = new DataInputStream(socket.getInputStream());

            //output stream to send data
            toServer = new DataOutputStream(socket.getOutputStream());

           


            new Thread(new VideoReceiver()).start();

        } catch (IOException ex) {
            
        }

    }
    
    public void sendServerCommand(String command){
        try {
            toServer.writeUTF(command);
            toServer.flush();
        } catch (IOException ex) {
           
        }
            
    }
    
    @Override
    public void run() {
    }

    class VideoReceiver implements Runnable {

        @Override
        public void run() {
            while (true) {
                try {
                    String str = (String) fromServer.readUTF();


                } catch (Exception ex) {
                }
            }

        }
    }
}
